package com.party.core.model.menu;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;
import com.party.core.model.BaseModel;

import java.io.Serializable;

/**
 * 菜单实体
 * party
 * Created by wei.li
 * on 2016/8/26 0026.
 */
public class Menu extends BaseModel implements Serializable {

    private static final long serialVersionUID = 8228105242767305458L;

    //父级编号
    private String parentId;

    //所有父级编号
    private String parentIds;

    //名称
    private String name;

    //排序
    private String sort;

    //链接
    private String href;

    //图标
    private String icon;

    //权限id
    private String privilegeId;

    //匹配规则
    private String rule;

    //权限代码
    private String permission;

    public String getPermission() {
        return permission;
    }

    public void setPermission(String permission) {
        this.permission = permission;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getParentId() {
        return parentId;
    }

    public void setParentId(String parentId) {
        this.parentId = parentId;
    }

    public String getParentIds() {
        return parentIds;
    }

    public void setParentIds(String parentIds) {
        this.parentIds = parentIds;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String href) {
        this.href = href;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getPrivilegeId() {
        return privilegeId;
    }

    public void setPrivilegeId(String privilegeId) {
        this.privilegeId = privilegeId;
    }


    public String getRule() {
        return rule;
    }

    public void setRule(String rule) {
        this.rule = rule;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        Menu menu = (Menu) o;
        return java.util.Objects.equals(parentId, menu.parentId) &&
                java.util.Objects.equals(parentIds, menu.parentIds) &&
                java.util.Objects.equals(name, menu.name) &&
                java.util.Objects.equals(sort, menu.sort) &&
                java.util.Objects.equals(href, menu.href) &&
                java.util.Objects.equals(icon, menu.icon) &&
                java.util.Objects.equals(privilegeId, menu.privilegeId) &&
                java.util.Objects.equals(rule, menu.rule);
    }

    @Override
    public int hashCode() {

        return java.util.Objects.hash(super.hashCode(), parentId, parentIds, name, sort, href, icon, privilegeId, rule);
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("parentId", parentId)
                .add("parentIds", parentIds)
                .add("name", name)
                .add("sort", sort)
                .add("href", href)
                .add("icon", icon)
                .add("privilegeId", privilegeId)
                .add("rule", rule)
                .toString();
    }
}
